package com.quartz2.jobs;

import org.quartz.Job;  
import org.quartz.JobExecutionContext;  
import org.quartz.JobExecutionException;  
import org.springframework.beans.factory.annotation.Autowired;  
import com.quartz2.manager.AutoJobDTO;
import com.quartz2.manager.TestService;
  
//@DisallowConcurrentExecution//有状态的任务需要加上这个注解  
public class JobAction implements Job {  
  
    @Autowired  
    private TestService testService;
    
    @Override  
    public void execute(JobExecutionContext arg0) throws JobExecutionException {  
        //.out.println("任务成功运行------");
        AutoJobDTO detailInfo = (AutoJobDTO)arg0.getMergedJobDataMap().get("scheduleJob");  
        //.out.println("任务名称 = [" + detailInfo.getJob_name()+ "]");
        if(testService==null){  
            //.out.println("注入不成功------");
        }else{  
            //.out.println("注入成功------");
            testService.add();  
        }  

    }  
  
}  